/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.ucue.ptc.gco.ws;

import edu.ucue.ptc.gco.mdl.Empleado;
import edu.ucue.ptc.gco.ngc.EmpleadoManagerLocal;
import edu.ucue.ptc.gco.util.AtributoInvalidoException;
import edu.ucue.ptc.gco.util.EmpleadoValidatorException;
import edu.ucue.ptc.gco.util.NoExisteObjetoException;
import java.util.List;
import javax.ejb.EJB;
import javax.jws.WebService;
import javax.ejb.Stateless;
import javax.jws.WebMethod;
import javax.jws.WebParam;

/**
 *
 * @author Johnny
 */
@WebService(serviceName = "EmpleadoWebService")
@Stateless()
public class EmpleadoWebService {
    @EJB
    private EmpleadoManagerLocal ejbRef;// Add business logic below. (Right-click in editor and choose
    // "Web Service > Add Operation"

    @WebMethod(operationName = "crearEmpleado")
    public void crearEmpleado(@WebParam(name = "empleado") Empleado empleado, @WebParam(name = "usuario") String usuario, @WebParam(name = "password") String password) throws EmpleadoValidatorException, AtributoInvalidoException {
        ejbRef.crearEmpleado(empleado, usuario, password);
    }

    @WebMethod(operationName = "modificarEmpleado")
    public void modificarEmpleado(@WebParam(name = "empleado") Empleado empleado, @WebParam(name = "usuario") String usuario, @WebParam(name = "password") String password) throws EmpleadoValidatorException, AtributoInvalidoException {
        ejbRef.modificarEmpleado(empleado, usuario, password);
    }

    @WebMethod(operationName = "buscarEmpleadoPorCedula")
    public Empleado buscarEmpleadoPorCedula(@WebParam(name = "cedula") String cedula, @WebParam(name = "usuario") String usuario, @WebParam(name = "password") String password) throws AtributoInvalidoException {
        return ejbRef.buscarEmpleadoPorCedula(cedula, usuario, password);
    }

    @WebMethod(operationName = "buscarEmpleadoPorId")
    public Empleado buscarEmpleadoPorId(@WebParam(name = "id") int id, @WebParam(name = "usuario") String usuario, @WebParam(name = "password") String password) throws AtributoInvalidoException {
        return ejbRef.buscarEmpleadoPorId(id, usuario, password);
    }

    @WebMethod(operationName = "eliminarEmpleadoPorCedula")
    public void eliminarEmpleadoPorCedula(@WebParam(name = "cedula") String cedula, @WebParam(name = "usuario") String usuario, @WebParam(name = "password") String password) throws NoExisteObjetoException, AtributoInvalidoException {
        ejbRef.eliminarEmpleadoPorCedula(cedula, usuario, password);
    }

    @WebMethod(operationName = "eliminarEmpleadoPorId")
    public void eliminarEmpleadoPorId(@WebParam(name = "id") int id, @WebParam(name = "usuario") String usuario, @WebParam(name = "password") String password) throws NoExisteObjetoException, AtributoInvalidoException {
        ejbRef.eliminarEmpleadoPorId(id, usuario, password);
    }

    @WebMethod(operationName = "eliminarEmpleado")
    public void eliminarEmpleado(@WebParam(name = "empleado") Empleado empleado, @WebParam(name = "usuario") String usuario, @WebParam(name = "password") String password) throws NoExisteObjetoException, AtributoInvalidoException {
        ejbRef.eliminarEmpleado(empleado, usuario, password);
    }

    @WebMethod(operationName = "listarEmpleado")
    public List<Empleado> listarEmpleado(@WebParam(name = "usuario") String usuario, @WebParam(name = "password") String password) throws AtributoInvalidoException {
        return ejbRef.listarEmpleado(usuario, password);
    }
    
}
